package com.ruge.user.controller;

import com.ruge.core.response.Response;
import com.ruge.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;

/**
 * @author ruge.wu
 * @since 2021/02/21 12:40
 */
@Slf4j
@Validated
@RestController
@RequestMapping("internal/user")
@Api(tags = "【用户 内部 接口】", value = "【用户 内部 接口】")
public class InternalUserController {

    @Resource
    private UserService userService;
    @GetMapping("getUserInfo")
    @ApiOperation(value = "【用户】  获取当前登录用户信息")
    public Response getUserInfo(@ApiParam(name = "aid", value = "用户id", required = true) @NotNull(message = "用户id") @RequestParam("aid") Long  aid) {
        return  userService.getUserInfo(Collections.singletonList(aid));
    }

    @PostMapping("getUserInfo")
    @ApiOperation(value = "【用户】  获取当前登录用户信息")
    public Response getUserInfo(@RequestBody List<Long> aids) {
        return  userService.getUserInfo(aids);
    }
}
